package com.wlj.form;

import com.wlj.validator.UniqueConstraint;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;

public class UserAddForm {

    @UniqueConstraint(message = "该用户名已使用!")
    private String username;

    @NotBlank(message = "密码不能为空")
    private String password;

    //传入的时间参数必须是过去的时间
//    @Past(message = "生日必须是过去的时间")
//    private Date birthday;

    @NotBlank(message = "手机号不能为空")
    private String phone;

    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式不对")
    private String email;

    @NotBlank(message = "地址不能为空")
    private String address;

    //@Size(min = 1,message = "至少选择一个角色")  多注解可以同时使用
    @NotNull(message = "至少选择一个角色")
    private String[] roles;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String[] getRoles() {
        return roles;
    }

    public void setRoles(String[] roles) {
        this.roles = roles;
    }
}
